package com.ruoyi.framework.config;

import com.kingdee.bos.webapi.entity.IdentifyInfo;
import com.kingdee.bos.webapi.sdk.K3CloudApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author YiYuan
 * @description
 * @date 2024/2/8
 */
@Configuration
public class KingdeeConfig {
    @Value("${KDapi.AcctID}")
    private String KDapiAcctID;
    @Value("${KDapi.AppID}")
    private String KDapiAppID;
    @Value("${KDapi.AppSec}")
    private String KDapiAppSec;
    @Value("${KDapi.UserName}")
    private String KDapiUserName;
    @Value("${KDapi.ServerUrl}")
    private String KDapiServerUrl;

    @Bean
    public K3CloudApi k3CloudApi() {
        IdentifyInfo iden = new IdentifyInfo();
        iden.setUserName(KDapiUserName);
        iden.setAppId(KDapiAppID);
        iden.setdCID(KDapiAcctID);
        iden.setAppSecret(KDapiAppSec);
        iden.setlCID(2052);
        iden.setServerUrl(KDapiServerUrl);
        return new K3CloudApi(iden);
    }
}
